<%@page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib uri="TowkerTagLib" prefix="rbac"%>
<%@include file="/commons/include/html_doctype.html" %>
<html>
<head>
	<title>选择物料信息</title>
	<%@include file="/commons/include/get.jsp" %>
    <script language="javascript" type="text/javascript" src="${ctx}/js/util/selectGoods.js"></script>
	<script type="text/javascript">
		function selectGoods() {
			var goods = [];
			$("#listForm input[name=keyIndex]").each(function(index) {
				if(this.checked)
					goods[goods.length] = {
						id : this.value,
						sn : $("#goodsSN"+this.value).val(),
						name : $("#name"+this.value).val(),
						stock : $("#stock"+this.value).val(),
						down_order : $("#down_order"+this.value).val(),
						tprice : $("#tprice"+this.value).val(),
						jprice : $("#jprice"+this.value).val(),
						bprice : $("#bprice"+this.value).val(),
						wprice : $("#wprice"+this.value).val(),
						sprice : $("#sprice"+this.value).val(),
						unit : $("#unit"+this.value).val(),
						weight : $("#weight"+this.value).val()
					};
			});
			parent.callback(goods);
		}
		function closeDialog() {
			parent.close();
		}
	</script>
	
</head> 
<body>
<div class="line"></div>
<form id="queryForm" method="get" action="selectGoods.htm" target="_self">
<table border="0" cellspacing="0" cellpadding="0" class="queryTable">
	<tr>
		<td class="title">品种代码：</td>
		<td class="input"><input id="title" name="goods_sn" class="input" value="${fn:escapeXml(param.goods_sn)}" /></td>
		
		<td class="title">品种名称：</td>
		<td class="input"><input id="title" name="goods_name" class="input" value="${fn:escapeXml(param.goods_name)}" /></td>
		
		<td class="query" colspan="2"><input id="_querySubmit_" type="submit" class="button" value="查询" /></td>
	</tr>
</table>
</form>
<div class="line"></div>
<form id="listForm" method="post" action="">
<table border="0" cellspacing="1" cellpadding="0" class="listTable">
	<tr class="list_title">
		<td style="width:3%"><input id="chkall" type="checkbox" /></td>
		<td>品种代码</td>
		<td>品种名称</td>
		<td>库存量</td>
		<td>下订单数量</td>
		<td>品种大类号</td>
		<td>品种小类号</td>
		<td>产品型号</td>
		<td>产品性质</td>
        <td>重量</td>
        <td>计量单位</td>
	</tr>
<c:forEach items="${pageModel.result}" var="d" varStatus="status">
	<tr class="${status.index%2==0?'list_even':'list_odd'}">
		<td nowrap="nowrap">
			<input name="keyIndex" type="checkbox" value="${d.id}" />
			<input type="hidden" id="goodsSN${d.id}" value="${d.goods_sn}" />
            <input type="hidden" id="name${d.id}" value="${d.goods_name}" />
			<input type="hidden" id="stock${d.id}" value="${d.stock}" />
            <input type="hidden" id="down_order${d.id}" value="${d.down_order}" />
			<input type="hidden" id="jprice${d.id}" value="${d.jprice}" />
			<input type="hidden" id="tprice${d.id}" value="${d.tprice}" />
			<input type="hidden" id="bprice${d.id}" value="${d.bprice}" />
			<input type="hidden" id="wprice${d.id}" value="${d.wprice}" />
			<input type="hidden" id="sprice${d.id}" value="${d.sprice}" />
            <input type="hidden" id="unit${d.id}" value="${d.unit}" />
            <input type="hidden" id="weight${d.id}" value="${d.weight}" />
		</td>
		<td>${fn:escapeXml(d.goods_sn)}</td>
		<td>${fn:escapeXml(d.goods_name)}</td>
		<td>${fn:escapeXml(d.stock)}</td>
		<td>${fn:escapeXml(d.down_order)}</td>
		<td>${fn:escapeXml(d.type_id)}</td>
		<td>${fn:escapeXml(d.class_id)}</td>
		<td>${fn:escapeXml(d.spec)}</td>
		<td>${fn:escapeXml(d.attr)}</td>
        <td>${fn:escapeXml(d.unit)}</td>
        <td>${fn:escapeXml(d.weight)}</td>
	  </tr>
</c:forEach>
</table>
<input id="_submit_" type="submit" style="display:none;" />
</form>
<table border="0" cellspacing="0" cellpadding="0" class="bottomTable">
	<tr><td>${pageNav.page}</td></tr>
	<tr><td align="center"><input type="button" value="确定" onClick="selectGoods()">
  <input type="button" value="取消" onClick="closeDialog()"></td></tr>
</table>
</body>
</html>
